import ComponentApi from "@/api/components/component"
const region = {
    state: {
      regionData:[],
      existData:false
    },
    mutations: {
     REGIONDATA(state,data){
        state.regionData = data
        state.existData = true
     }
  
    },
    actions: {
      async regionData({commit}){
        let res = await ComponentApi.treeRegion()
        if(res.status == 0){
            commit("REGIONDATA",res.data)
            return res.data
        }else{
            return Promise.inject(new Error())
        }
      }
    }
  }
  
  export default region
  